package servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "Servlet07", value = "/hello")
public class Servlet07 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //   http://localhost/web02/hello?name=jiangjun&age=25&phone=1333333333
        //   name=jiangjun 是客户端通过地址栏发给服务器的参数
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        String phone = request.getParameter("phone");
        System.out.println(name);
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        out.print("<h1>"+name+"欢迎您!!</h1>");
        out.print("<h1>"+age+"</h1>");
        out.print("<h1>"+phone+"</h1>");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
